Skip to content

Comments

Recovery mcp server#106

Open
gsharini wants to merge 13 commits intooracle:mainfrom
gsharini:recovery_mcp_server
Open

Recovery mcp server#106
gsharini wants to merge 13 commits intooracle:mainfrom
gsharini:recovery_mcp_server

Conversation

@gsharini
Copy link
Member

Introduce a new MCP server: OCI Autonomous Recovery Service MCP Server (oci-recovery-mcp-server). This server exposes tools to query and summarize Oracle Cloud Infrastructure (OCI) Autonomous Recovery Service resources such as Protected Databases, Protection Policies, Recovery Service Subnets, DB Homes/Databases, DB Systems, and related metrics. It also includes a comprehensive test suite for the new tools and models, along with linting fixes.

Key changes:

  • New package at src/oci-recovery-mcp-server with:

    • pyproject.toml and package scaffolding
    • Server implementation (oracle/oci_recovery_mcp_server/server.py)
    • Data models (oracle/oci_recovery_mcp_server/models.py)
    • init files and README/License
  • New unit tests:

    • oracle/oci_recovery_mcp_server/tests/test_recovery_tools.py
    • oracle/oci_recovery_mcp_server/tests/test_recovery_database_tools.py
  • Lint fixes and minor improvements, plus a few additional custom tools

Implemented tools (server API surface):

  • Identity/compartment helper:

    • get_compartment_by_name_tool
  • Recovery Service - Protected Databases and health:

    • list_protected_databases
    • get_protected_database
    • summarize_protected_database_health
    • summarize_protected_database_redo_status
    • summarize_backup_space_used
  • Recovery policies and subnets:

    • list_protection_policies
    • get_protection_policy
    • list_recovery_service_subnets
    • get_recovery_service_subnet
  • Recovery metrics:

    • get_recovery_service_metrics (SpaceUsedForRecoveryWindow, ProtectedDatabaseSize, ProtectedDatabaseHealth, DataLossExposure)
  • Database/backup surface for context:

    • list_databases, get_database
    • list_backups, get_backup
    • summarise_protected_database_backup_destination
    • get_db_home
    • list_db_systems, get_db_system

Motivation:

  • Provide an MCP-compliant interface for OCI Recovery Service operations, enabling tools-based automation and summarization within MCP-enabled editors/agents.
  • Add test coverage to ensure correctness of request shaping, response handling, and summary logic.

Dependencies:

  • Uses OCI Python SDK (already standard in this repository’s ecosystem).
  • No new external runtime dependencies beyond those specified in the new subpackage’s pyproject.toml.

Fixes # N/A (feature addition)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update (new server README added; main docs may need a link/section)

How Has This Been Tested?

  • Added unit tests for tool behavior and models:

    • oracle/oci_recovery_mcp_server/tests/test_recovery_tools.py
    • oracle/oci_recovery_mcp_server/tests/test_recovery_database_tools.py
  • Tests validate request building, mock-backed responses, health/redo/backup summaries, and error handling paths.

Reproduce locally:

  • Option A (pip):

    • python -m venv .venv && source .venv/bin/activate
    • pip install -U pip
    • pip install -e src/oci-recovery-mcp-server[dev]
    • pytest -q src/oci-recovery-mcp-server/oracle/oci_recovery_mcp_server/tests
  • Option B (uv):

    • cd src/oci-recovery-mcp-server
    • uv pip install -e ".[dev]"
    • uv run pytest -q

Notes:

  • Tests mock OCI client interactions and do not require live OCI credentials.

  • Test A: Tool and model unit tests (mocked)

  • Test B: Summary computations (health, redo, backup space)

Test Configuration:

  • Firmware version: N/A
  • Hardware: N/A
  • Toolchain: Python 3.x, pytest
  • SDK: OCI Python SDK (mocked in tests)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (new server README)
  • My changes generate no new warnings
  • I have added tests that prove my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 28, 2025
from . import __project__, __version__

"""MCP tools available in this server:
- get_compartment_by_name_tool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tool should exist within the identity MCP server

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review comment — I agree that, compartment lookup is an identity concern and the tool already exists in the identity MCP server.

But, our intent here is to keep the Recovery Service MCP server self-sufficient from a user’s perspective. If this tool is removed, users would be required to configure multiple MCP servers (identity + recovery) just to perform basic recovery workflows, which increases setup friction and adoption complexity.

Please let me know your view on this.

- get_database
- list_backups
- get_backup
- summarise_protected_database_backup_destination
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- summarise_protected_database_backup_destination
- summarize_protected_database_backup_destination


## Tools

- list_protected_databases(compartment_id, lifecycle_state=None, display_name=None, id=None, protection_policy_id=None, recovery_service_subnet_id=None, limit=None, page=None, sort_order=None, sort_by=None, opc_request_id=None, region=None) -> list[ProtectedDatabaseSummary]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot more tools in the server file than what is included here. Can we update this list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Updated the list.

@gsharini
Copy link
Member Author

@cboffa13 Can you review the changes merged in response to the comments?

@LesiaChaban LesiaChaban requested a review from krisrice January 13, 2026 12:45
@gsharini
Copy link
Member Author

Can someone please review and help merge this code ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants